home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / smailsrc.zip / PASSWD.ZIP / README < prev    next >
Text File  |  1990-04-03  |  4KB  |  92 lines

  1.                  MS-DOS passwd library
  2.                    Stephen C. Trier
  3.  
  4.      In the process of porting UNIX software to MS-DOS, especially news and
  5. mail packages, I've run into a need for the UNIX-style password file
  6. functions.  This time I couldn't find a different way out, so I whipped up
  7. these functions.  They aren't secure, and they aren't intended to be.  Instead,
  8. they are meant to access the second function of the UNIX passwd file, which is
  9. to contain information about various users.  This they should do well.  Please
  10. note again: THESE FUNCTIONS ARE NOT INTENDED TO BE USED TO PROVIDE SECURITY TO
  11. AN MS-DOS SYSTEM.  However, they _are_ intended to simplify the task of porting
  12. UNIX applications to the MS-DOS environment.
  13.  
  14.      The most significant difference between these functions and the UNIX
  15. version is the format of the /etc/passwd file.  Because home directory
  16. specifications should really include a drive letter, and the drive name
  17. requires a colon, these routines expect the file to have its fields separated
  18. by semicolons.  This should not change the functionality of these routines,
  19. because the delimiter is never seen by the application program.
  20.  
  21.      Where will the password file be found?  The library looks for a shell
  22. variable named PASSWD to determine the location of the file.  If that variable
  23. has not been defined, the library uses a UNIX-style path of /etc/passwd.  Your
  24. program can override these choices, however, by calling the function pw_open()
  25. with a filename as an argument.  Calling pw_open with NULL as the argument
  26. tells it to use the shell-variable and default name to find the file.
  27.  
  28.      I cannot guarantee that these functions are a wonderfully exact clone of
  29. the UNIX versions; there may even be some big differences.  This is because I
  30. have no real documentation available about the UNIX versions.  However, that
  31. also means that I am free to place my version in the public domain.  Use it as
  32. you wish, and I would be quite interested in hearing of any changes or
  33. improvements you make.
  34.  
  35.      There is a simple makefile included, but it is not capable of building
  36. more than one library at a time.  That's a bit beyond my makefile-writing
  37. ability, so if you want a fully-automated, whiz-bang makefile, you'll have to
  38. write it yourself.  (I'd be rather interested in such a beast, to tell the
  39. truth.)
  40.  
  41.      Hope these are useful to you.
  42.  
  43.           Stephen
  44.  
  45.  
  46.  
  47. How to reach me by email:
  48.    sct%seldon@scl.cwru.edu will work until May 1990, and (maybe) later.
  49.    sct@po.cwru.edu will work throughout the scholastic year.
  50.    sct@seldon.UUCP will work once I find another feed and get a map entry.
  51.  
  52. Sample output from the test program:
  53.  
  54. ---------- cut here ----------
  55. Name: user1  Password: password1  User Num: 1  Group Num: 11
  56. Full Name: Joe User  Home Dir: \homes\user1  Shell: sh1
  57.  
  58. Name: user2  Password: password2  User Num: 2  Group Num: 12
  59. Full Name: Joe User Jr.  Home Dir: \homes\user2  Shell: sh2
  60.  
  61. Name: user3  Password: password3  User Num: 3  Group Num: 13
  62. Full Name: Joe User III  Home Dir: \homes\user3  Shell: sh3
  63.  
  64. setpwent returns 0
  65. Name: user1  Password: password1  User Num: 1  Group Num: 11
  66. Full Name: Joe User  Home Dir: \homes\user1  Shell: sh1
  67.  
  68. Name: user2  Password: password2  User Num: 2  Group Num: 12
  69. Full Name: Joe User Jr.  Home Dir: \homes\user2  Shell: sh2
  70.  
  71. Name: user3  Password: password3  User Num: 3  Group Num: 13
  72. Full Name: Joe User III  Home Dir: \homes\user3  Shell: sh3
  73.  
  74. setpwent returns 0
  75. Finding user3: user3
  76. Finding user1: user1
  77. Finding user2: user2
  78. Finding user4: NULL  (Should be NULL)
  79.  
  80. Finding user id 2: user2
  81. Finding user id 1: user1
  82. Finding user id 3: user3
  83. Finding user id 4: NULL  (Should be NULL)
  84.  
  85. endpwent returns 0
  86. --------- cut here ---------
  87.  
  88. Remember that in order to get this output, one of the following must be true:
  89. (1) the included "passwd" file is in \etc\passwd, or (2) the $PASSWD
  90. environment variable must point to its location.  (set PASSWD=passwd is
  91. probably sufficient for testing purposes.)
  92.